﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Windows.Forms;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Nmo;
using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlServer.Management.Trace;

namespace Entity
{
    public class CV_GIAOVIEN
    {
        DataBaseAccess dataBaseAccess = new DataBaseAccess();

        private String MAGV, MACV;

        public String maGV
        {
            get { return MAGV; }
            set { MAGV = value; }
        }

        public String maCV
        {
            get { return MACV; }
            set { MACV = value; }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="dtgChucVuGiaoVien"></param>
        public void hienthi_ChucVuGiaoVien(DataGridView dtgChucVuGiaoVien)
        {
            String excuteString = "SELECT * FROM CV_GIAOVIEN";
            DataTable dataTable = new DataTable();
            dataTable = dataBaseAccess.getDataTable(excuteString);
            dtgChucVuGiaoVien.DataSource = dataTable;
        }

        public void them_CVGiaoVien(CV_GIAOVIEN cv_giaovien)
        {
            String excuteString = "INSERT INTO CV_GIAOVIEN VALUES('" + cv_giaovien.maGV + "','"
                                                                    + cv_giaovien.maCV + "')";
            dataBaseAccess.excuteNonQuery(excuteString);
        }

        public void sua_CVGiaoVien( CV_GIAOVIEN cv_giaovien)
        {
            String excuteString = "UPDATE CV_GIAOVIEN SET MACV ='" + cv_giaovien.maCV +
                                                "'WHERE MAGV='" + cv_giaovien.maGV + "'";
            dataBaseAccess.excuteNonQuery(excuteString);
        }

        public void xoa_CVGiaoVien(String magv)
        {
            String excuteString = "DELETE FROM CV_GIAOVIEN WHERE MAGV ='" + magv + "'";
            dataBaseAccess.excuteNonQuery(excuteString);
        }
        
    }
}
